﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using CINES.ITECH.BUSINESS.ENTITIES;
using CINES.ITECH.BUSINESS.LOGIC;
using System.Net;
using System.IO;
using System.Data;


namespace CINES.ITECH.TEST
{
    /// <summary>
    /// Tests de las funcionalidades de promociones.
    /// </summary>
    [TestClass]
    public class TestsPromocion
    {
 

        [TestMethod]
        public void ListarPromocionesTest()
        {
            string id = "8881";
            HttpWebRequest req = WebRequest.Create("http://localhost:49911/Promociones.svc/Promocion/"+id ) as HttpWebRequest;
            req.KeepAlive = false;
            req.Method = "GET";
            HttpWebResponse resp = req.GetResponse() as HttpWebResponse;
            Encoding enc = System.Text.Encoding.GetEncoding(1252);
            StreamReader loResponseStream = new StreamReader(resp.GetResponseStream(), enc);
            string Response = loResponseStream.ReadToEnd();
            var tbl = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(Response);
            Assert.IsTrue(tbl.Rows.Count > 0);

        }
    }
}
